IDENTIFYING RULE-BASED RATIONALTY - DATA


OVERVIEW

The data and analysis is in Stata, with the exception of the Afriat/Garp calculations that is in Matlab.

The code was tested using Stata 15 and Matlab 2018b. The raw and final data file were saved using Stata's "saveold" command and should be compatible with Stata versions from Stata 13 onwards.

MAIN FILES

Table1.do - stata do file corresponding to Table 1 in the paper (uses comb.dta)
Table2.do - stata do file corresponding to Table 2 in the paper (uses comb.dta)
Table3.do - stata do file corresponding to Table 3 in the paper (uses comb.dta)
Table4.do - stata do file corresponding to Table 4 in the paper (uses comb.dta)
Table5.do - stata do file corresponding to Table 5 in the paper (uses comb.dta)

raw.dta - raw data (compatible with Stata 13 onwards)
subjects.dta - data on subjects (produced from raw.dta)
allocations.dta - the allocations subjects made (produced from raw.dta)
comb.dta - subjects file + GARP/Afriat analysis of allocations (compatible with Stata 13 onwards)

prep.do - stata do file that creates subjects.dta and allocations.dta from raw.dta
ruleAnalysis.do  - stata do file used in prep.do to analyse the rules subjects choose
allocations.do - stata do file used in prep.do to create allocations.dta
preGarp.do - stata do file that exports allocations data for use in Matlab code
postGarp.do - stata do file that imports Matlab output to create comb.dta


VARIABLES

A dictionary of variables is available in the stata dta files


GARP ANALYSIS

The Garp analysis is in a subdirectory called 'garp'.

The .csv files are allocations data created by preGarp.do
The .txt files are the output of the matlab analysis (imported back into Stata by postGarp.do)

calcGarp.m reads the allocations data, invokes testGarp and saves the results. It should be run separately for each number of companies: calcGarp(2), calcGarp(3), and calcGarp(6)

testGarp.m interfaces with the RP-Toolkit (revealed preference code developed as part of Halevy, Persitz, and Zrill, JPE 2018). For testGarp.m to run correctly, you need to download RP-Toolkit from GitHub (https://github.com/persitzd/RP-Toolkit) and add the directory that contains HPZ_Subject_Consistency.m to the matlab path.





